package com.gd.controller;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.gd.model.Deal;
import com.gd.service.DealListService;

@Controller
public class DealListController {
	private static Log log = LogFactory.getLog(DealListController.class);
		
	@Autowired
	private DealListService dealListService;
	
	
	@RequestMapping("/deals")
	public String getAssetList(Model model) {
		List<Deal> deals = dealListService.getLatestDeals();
		log.info("deals count: " + deals.size());
		model.addAttribute("deals", deals);
		return "dealList";
	}
}
